﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace LevenBlog.Core.Utils
{
    public static class ErrorPrinter
    {
        private static HttpContext context = HttpContext.Current;

        public static void Out(string message)
        {
            context.Response.Write(message);
            End();
        }

        public static void Out(ErrorException err)
        {
            context.Response.Write(string.Format("<h3>{0}</h3>", err.Title));
            context.Response.Write("<br />");
            context.Response.Write(err.Message);
            context.Response.Write("<br />");
            context.Response.Write(err.Url);
            End();
        }

        public static void End()
        {
            try
            {
                context.Response.End();
            }
            catch (System.Threading.ThreadAbortException)
            {
            }
        }
    }
}
